﻿<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">
    <ui:define name="head">
        <link type="text/css" href="#{request.contextPath}/UI/epss/epss.css" rel="stylesheet"/>
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
            function actSelect(obj) {
                var pkid=obj;
                var sfeature = "dialogwidth:1100px;dialogheight:600px;center:yes;location:no;help:no;resizable:no;scroll:no;status:no";
                var arg = new Object();
                arg.doType = "select";
                var rtn =dialog("../item/itemMng_SubcttEngPStl.xhtml?strEsInitStlSubcttEng="+pkid+"",arg,sfeature);
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <h:form id="form">
            <p:growl id="msgs" showDetail="true"/>
            <p:panel header="未形成结算单" style="width: 100%">
                <h:panelGrid id="pgConditionNotForm" columns="2" style="width: 100%">
                    <h:panelGrid columns="4">
                        <h:outputLabel value="分包合同：" for="idNotForm" />
                        <p:selectOneMenu id="idNotForm"
                                         value="#{esInitSubcttStlPAction.itemEsInitStlNotForm.stlPkid}">
                            <f:selectItems value="#{esInitSubcttStlPAction.subcttList}"/>
                        </p:selectOneMenu>
                        <h:outputLabel value="期数编码：" for="periodNoNotForm"/>
                        <p:inputText id="periodNoNotForm" value="#{esInitSubcttStlPAction.itemEsInitStlNotForm.periodNo}"
                                     onclick="WdatePicker({dateFmt:'yyyyMM'})"/>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <p:commandButton id="qryBtnNotForm" value="查询"
                                         action="#{esInitSubcttStlPAction.onQueryFormPreAction('Approve')}"
                                         update="pdtNotForm,msgs">
                        </p:commandButton>
                        <p:commandButton id="resetBtnNotForm" value="重置"
                                         action="#{esInitSubcttStlPAction.resetAction}"
                                         update="pgConditionNotForm,msgs">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
                <p:dataTable id="pdtNotForm" style="width:100%;"
                             value="#{esInitSubcttStlPAction.itemEsInitStlNotFormList}"
                             var="recordNotForm"
                             rowKey="#{recordNotForm.pkid}"
                             selection="#{esInitSubcttStlPAction.itemEsInitStlNotFormSelected}"
                             selectionMode="single"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                             {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true"
                             paginatorPosition="bottom"
                             rows="5"
                             rowIndexVar="rowNotForm"
                             rowsPerPageTemplate="100,50,40,30,20,10,5"
                             rowStyleClass="#{recordNotForm.id eq '分包结算单'?'rowDoneStyle':null}"
                             emptyMessage="数据记录为空..."
                             scrollable="true"
                             scrollHeight="200">
                    <p:column headerText="序号" style="width:30px">
                        <h:outputText value="#{rowNotForm + 1}"/>
                    </p:column>
                    <p:column headerText="结算编号" style="text-align:center;width:120px">
                        <h:outputText value="#{recordNotForm.id}"/>
                    </p:column>
                    <p:column headerText="分包合同" style="text-align:left;width:200px">
                        <h:outputText value="#{recordNotForm.stlName}"/>
                    </p:column>
                    <p:column headerText="协作单位" style="text-align:left;width:200px">
                        <h:outputText value="#{recordNotForm.signPartBName}"/>
                    </p:column>
                    <p:column headerText="期数编码" style="text-align:center;width:66px">
                        <h:outputText value="#{recordNotForm.periodNo}"/>
                    </p:column>
                    <p:column headerText="今期状态" style="text-align:center;width:66px;">
                        <h:outputText value="#{esFlowControl.getLabelByValueInStatusFlaglist(recordNotForm.statusFlag)}"/>
                    </p:column>
                    <p:column headerText="今期原因" style="text-align:center;width:66px;">
                        <h:outputText value="#{esFlowControl.getLabelByValueInPreStatusFlaglist(recordNotForm.preStatusFlag)}"/>
                    </p:column>
                    <p:column headerText="结束标志" style="text-align:center;width:66px;">
                        <h:outputText value="#{esFlowControl.getLabelByValueInEndFlagList(recordNotForm.endFlag)}"/>
                    </p:column>
                </p:dataTable>
            </p:panel>
            <p:panel header="已形成结算单" style="width: 100%">
                <h:panelGrid id="pgCondition" columns="2" style="width: 100%">
                    <h:panelGrid columns="4">
                        <h:outputLabel value="分包合同：" for="id" />
                        <p:selectOneMenu id="id"
                                         value="#{esInitSubcttStlPAction.itemEsInitStl.stlPkid}"
                                         disabled="#{esInitSubcttStlPAction.styleModel.disabled_Flag}"
                                         style="#{esInitSubcttStlPAction.styleModel.disabled_Style};">
                            <f:selectItems value="#{esInitSubcttStlPAction.subcttList}"/>
                        </p:selectOneMenu>
                        <h:outputLabel value="期数编码：" for="periodNo"/>
                        <p:inputText id="periodNo" value="#{esInitSubcttStlPAction.itemEsInitStl.periodNo}"
                                     onclick="WdatePicker({dateFmt:'yyyyMM'})"
                                     disabled="#{esInitSubcttStlPAction.styleModel.disabled_Flag}"
                                     style="#{esInitSubcttStlPAction.styleModel.disabled_Style};"/>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <p:commandButton id="qryBtn" value="查询"
                                         action="#{esInitSubcttStlPAction.onQueryFormedAction('Approve','true')}"
                                         update="pdt,msgs">
                        </p:commandButton>
                        <p:commandButton id="resetBtn" value="重置"
                                         action="#{esInitSubcttStlPAction.resetAction}"
                                         update="pgCondition,msgs">
                        </p:commandButton>
                    </h:panelGrid>
                    <h:panelGrid columns="3" rendered="#{esInitSubcttStlPAction.strRowSelectedFlag}">
                        <p:commandButton id="ApprovePassBtn" value="批准通过"
                                         action="#{esInitSubcttStlPAction.onClickForPowerAction('ApprovePass')}"
                                         update="pgCondition,pdt,msgs"
                                         rendered="#{esInitSubcttStlPAction.strApprovedFlag}">
                        </p:commandButton>
                        <p:commandButton id="ApproveFailToQBtn" value="批准未过至分包数量结算"
                                         action="#{esInitSubcttStlPAction.onClickForPowerAction('ApproveFailToQ')}"
                                         update="pgCondition,pdt,msgs"
                                         rendered="#{esInitSubcttStlPAction.strApprovedFlag eq 'true'?'false':'true'}">
                        </p:commandButton>
                        <p:commandButton id="ApproveFailToMBtn" value="批准未过至分包材料结算"
                                         action="#{esInitSubcttStlPAction.onClickForPowerAction('ApproveFailToM')}"
                                         update="pgCondition,pdt,msgs"
                                         rendered="#{esInitSubcttStlPAction.strApprovedFlag eq 'true'?'false':'true'}">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>
                <!--列表维护-->
                <p:contextMenu for="pdt">
                    <p:menuitem value="选择" icon="ui-icon-plus"
                                actionListener="#{esInitSubcttStlPAction.selectRecordAction('Approve','')}"
                                update="pdt,msgs,pgCondition">
                    </p:menuitem>
                    <p:menuitem value="详细内容" icon="ui-icon-search"
                                oncomplete="actSelect(DtInitSubcttList.selection)" >
                    </p:menuitem>
                </p:contextMenu>
                <p:dataTable id="pdt" style="width:100%;"
                             value="#{esInitSubcttStlPAction.itemEsInitStlList}"
                             var="record"
                             rowKey="#{record.pkid}"
                             selection="#{esInitSubcttStlPAction.itemEsInitStlSelected}"
                             selectionMode="single"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                             {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true"
                             paginatorPosition="bottom"
                             rows="5"
                             rowIndexVar="row"
                             rowsPerPageTemplate="100,50,40,30,20,10,5"
                             emptyMessage="数据记录为空..."
                             widgetVar="DtInitSubcttList"
                             rowStyleClass="#{record.statusFlag eq '3'?'rowDoneStyle':null}"
                             scrollable="true"
                             scrollHeight="200">
                    <p:column headerText="序号" style="width:30px">
                        <h:outputText value="#{row + 1}"/>
                    </p:column>
                    <p:column headerText="结算编号" style="text-align:center;width:120px">
                        <h:outputText value="#{record.id}"/>
                    </p:column>
                    <p:column headerText="分包合同" style="text-align:left;width:200px">
                        <h:outputText value="#{record.stlName}"/>
                    </p:column>
                    <p:column headerText="协作单位" style="text-align:left;width:200px">
                        <h:outputText value="#{record.signPartBName}"/>
                    </p:column>
                    <p:column headerText="期数编码" style="text-align:center;width:66px">
                        <h:outputText value="#{record.periodNo}"/>
                    </p:column>
                    <p:column headerText="今期状态" style="text-align:center;width:66px;">
                        <h:outputText value="#{esFlowControl.getLabelByValueInStatusFlaglist(record.statusFlag)}"/>
                    </p:column>
                    <p:column headerText="今期原因" style="text-align:center;width:66px;">
                        <h:outputText value="#{esFlowControl.getLabelByValueInPreStatusFlaglist(record.preStatusFlag)}"/>
                    </p:column>
                    <p:column headerText="结束标志" style="text-align:center;width:66px;">
                        <h:outputText value="#{esFlowControl.getLabelByValueInEndFlagList(record.endFlag)}"/>
                    </p:column>
                </p:dataTable>
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>